package com.swjd.sell.service.impl;

import com.swjd.sell.dao.ProductCategoryDao;
import com.swjd.sell.pojo.ProductCategory;
import com.swjd.sell.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 刘涛
 * @create 2021/8/23 2:01
 */
@Service
public class ProductCategoryServiceImpl implements ProductCategoryService {
    @Autowired
    private ProductCategoryDao productCategoryDao;
    @Override
    public ProductCategory selectById(Integer categoryId) {
        ProductCategory productCategory = productCategoryDao.selectById(categoryId);
        return productCategory;
    }

    @Override
    public List<ProductCategory> selectAll() {
        List<ProductCategory> productCategories = productCategoryDao.selectList(null);
        return productCategories;
    }

    @Override
    public List<ProductCategory> selectByCategoryTypeIn(List<Integer> categoryTypeList) {
        List<ProductCategory> allByCategoryType = productCategoryDao.findAllByCategoryTypeIn(categoryTypeList);
        return allByCategoryType;
    }

    @Override
    public int insert(ProductCategory productCategory) {
        int i = productCategoryDao.insert(productCategory);
        return i;
    }
}
